1. Field of the Invention
The present invention relates to a device for concurrently executing processings on a database.
2. Description of the Prior Art
Allowing a plurality of independent terminals to freely process records in a database device, for example, independent terminals 1, 2, as illustrated in a schematic of a processing procedure of FIG. 1, may concurrently process data stored in the same record A in the database system. As exemplified in FIG. 1, after the terminal 1 reads data out of a database system 3, the terminal 2 reads out the same data in the record A from the database system 3, corrects the data, and writes it in the same record A of the database so as to update it. Thereafter, the terminal 1 successively updates the contents of the record A. In this instance, a problem may be produced that the updating by the terminal 2 is invalid due to the updating by the terminal 1.
A method to solve the difficulty is disclosed in "The Systems Programing Series Volume II An Introduction to Database Systems" by C. J. Date, published by Addison-Wesley pp 83-119.
A general example to solve the problem will be described with reference to a processing procedure shown in FIG. 2.
A database system 3 has a data locking mechanism which supervises access from a terminal in a unit of record in a database or a unit of a file constituting a plurality of records, which executes shared mode locking and exclusive mode locking. The shared mode locking is set as a certain terminal retrieves data from the database system, i.e. reads out the data. Furthermore, the shared mode locking allows other terminals to execute only retrieval processing on the same record or the same file, and rejects the execution of updating. The exclusive mode locking is set as a certain terminal updates data in the database and rejects execution of retrieving and updating on the same record or file by other terminals.
As shown in FIG. 2, the terminal 1 requests that the database system 3, upon executing retrieval processing, lock a processing object record in a shared mode. The database system 3 confirms whether or not the processing object record has been locked in the exclusive mode by the other terminal, and if not locked, allows the terminal 1 to lock the record; after the terminal 1 locks the concerned record in the shared mode, it delivers data stored in the concerned record to the terminal 1. The terminal 1, which has received the data, corrects and alters the data, and when execution of updating of the record in the database system 3 is needed, requests the database system 3 to lock the processing object record in the exclusive mode. The database system 3, so requested, allows the terminal 1 to lock the record under the condition that the record has not been locked by the other terminal in either the shared or the exclusive modes. The terminal 1, whose locking operation is allowed, delivers the corrected and altered data to the database system 3 and updates the data, and thereafter requests the database system 3 to unlock the record. The database system 3, subjected to the unlocking request, unlocks the record. However, the device which concurrently executes database processing is designed on the assumption that updated data is clarified from the beginning of the processing and the device is profitably employed for routine works where each processing is completed in a short period of time. Against this, applying the device to nonroutine works where the device interactively has access to the database, data updating is determined at need after the data is read out of the database. Accordingly, the time required for locking the record being an object of the database in the shared mode is lengthened, whereby the device suffers from the fact that updating by the other terminal is disturbed and concurrency of the processing is lowered.